import axios from "@/utils/http";

//数据
const state = {
  //总数据
  tableData: [],
  //分页数据
  tableTotal: 1,
  //获取所有数据
  allData:[],

};

const getters = {
  getDepartmentData(state: any) {
    return state.tableData;
  },

  //获取所有的数据
  getallData(state:any){
    let arr = state.allData
    console.log(arr);
    return arr
  },
};

const actions = {};

const mutations = {
  /* setDepartmentData */
  /* ———————————————————————————— 获取所有的数据 ———————————————————————————— */
  setDepartmentData(state: any, page: any) {
    console.log("page", page);

    axios({
      url:"/setting/officeManage/findOfficeList",
      method: "get",
      params: {
        CurrentPage: page.currentPage,
        // PageSize: page.pageSize,
        PageSize:10,
      },
    })
      .then((res: any) => {
        console.log("字典数据", res.data);
        state.tableData = res.data.data;
        state.tableTotal = res.data.count;
      })
      .catch((err) => {
        console.log(err);
      });
  },
  }

   


 
  

export default {
  state,
  mutations,
  actions,
  getters,
};
